<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .div1{
            width: 200px;
            height:200px;
            text-align: center;
            position: relative;
        }
        .div2{
            width: 200px;
            height: 200px;
            line-height: 200px;
            background: #0099CC;
            position: absolute;
            left: 0;
            bottom: 0;
        }
        .mask{
            width: 200px;
            height: 200px; /* 高度是变量 */
            position: absolute;
            left: 0;
            top: 0; /* top是变量 */
            animation: animate 5s ease infinite;
            overflow: hidden;
        }
        @keyframes animate{
            from {
                height: 0px;
                top : 200px;
            }
            to {
                height: 200px;
                top : 0px;
            }
        }
    </style>
</head>
<body>
    <div class="div1">
        <div class="mask">
            <div class="div2">我是div顶部</div>
        </div>
    </div>
</body>
</html>